<template>
	<view class="ov">
		<view class="pt20 pd " v-if="xzsdfd.length>0">
			<scroll-view scroll-x="true" class="sdfdtyser">
				<image :src="sd.avatar" class="yj jjhnxeert" v-for="sd in xzsdfd"></image>
			</scroll-view>
		</view>
		<view class="mt70 pd">
			<view class="pr">
				<input type="text" value="" placeholder="请输入好友名称或账号搜索" class="kjjnmxeer" />
				<icon type="search" size="20" class="kkjdeeet" color="#999" />
			</view>
		</view>
		<view class="pr kjhjdeert" :style="{height:hhgbsd+'px'}">
			<scroll-view scroll-y="true" class="h100 " :scroll-into-view="jhbnsd">
				<view class="pd" v-for="(item,idx) in list" :key="idx" :id="idx">
					<view class="cf fz32">
						{{idx}}
					</view>
					<view class="row sderttr pt20 pm20" v-for="(sf,idx) in item" @tap="jjhssdf(sf)" :key="idx">
						<view class="">
							<image src="../../../static/img/xuanhsd.png" class="kjjsee cz ab" v-if="sf.cls"></image>
							<text class="kjjsee cz f_b" v-else></text>
						</view>
						<view class="ml30">
							<image :src="sf.avatar" class="yj useertty cz"></image>
						</view>
						<view class="cf fz32 pl20">
							{{sf.friend}}
						</view>
					</view>
				</view>
			</scroll-view>
			<view class="kjnxeerty">
				<view class="drttsewert" v-for="(sd,idx) in list" :key="idx" @tap="kkjnxert(idx)">
					<text class="cf" v-if="jhbnsd==idx">{{idx}}</text>
					<text class="z9" v-else>{{idx}}</text>
				</view>
			</view>

		</view>
	</view>
</template>
<script>
	import airport from '@/common/airport.js'
	export default {
		data() {
			return {
				list: [],
				jhbnsd: 'A',
				hhgbsd: 0,
				xzsdfd: []
			}
		},
		components: {

		},
		onNavigationBarButtonTap() {
				
			if(this.type==2){
				uni.navigateBack({
					delta:1
				})
				return
			}
			const xzsdfd = JSON.stringify(this.xzsdfd)
			console.log(xzsdfd)
			uni.redirectTo({
				url:'/pages/user/TransportManagement/CreateGroupnext?data='+xzsdfd
			})
		},
		onLoad() {
			let hggsde = uni.getSystemInfoSync().windowHeight
			this.hhgbsd = hggsde - 110
			console.log(2222222222222)
			this.lists()
		},
		methods: {
			jjhssdf(sf) {
				var that=this
				if (sf.cls) {
					sf.cls = ''
				} else {
					sf.cls = "act"
				}
				this.xzsdfd= []				
				for(var a in that.list){
					console.log("得到的a",JSON.stringify(that.list[a]))
					var aa=that.list[a]
					aa.map(b=>{
						if(b.cls){
							that.xzsdfd.push(b)
						}
					})
				}
				console.log("得到的xzsdfd",this.xzsdfd)
				if(this.xzsdfd.length>0){
					this.hhgbsd =  uni.getSystemInfoSync().windowHeight - 180
				}else{
					this.hhgbsd =  uni.getSystemInfoSync().windowHeight - 110
				}
				
			},
			kkjnxert(e) {
				this.jhbnsd = e 
			},
			async lists(){
				let flits=await this.get('/api/friends')
				console.log("好友列表",flits)			 	
				this.list=flits.data
			}
		},
		mounted() {}
	}
</script>
<style scoped>

</style>
